﻿#include "Resource.h"
Resource::Resource(const QString& name, const QString& path)
{
	addPixmap(name, path);
}
void Resource::addPixmap(const QString& name, const QString& path)
{
	m_iRes.addPixmap(name,path);
	/*QString currPath= QDir::currentPath();
	currPath = currPath+"/"+ path;
	QDir dir(currPath);
	if(!dir.isReadable())
		qWarning() << "当前路径：" << currPath<<"错误";
		m_map[name].append(QPixmap(currPath));*/

}

void Resource::addMovie(const QString& name, const QString& path)
{
	m_iRes.addMovie(name, path);
}

QPixmap& Resource::getPixmap(const QString& name, const int index)
{
	return m_iRes.getPixmap(name, index);
	//return m_map[name][index];
}

QVector<QPixmap>* Resource::getPixmaps(const QString& name)
{
	return m_iRes.getPixmaps(name);
	/*if (m_map.find(name) == m_map.end())
	{
		qWarning() << "没有找到:" << name;
		return nullptr;
	}*/
	//return &m_map[name];
}

QMovie* Resource::getMovie(const QString& name)
{
	return m_iRes.getMovie(name);
}

void Resource::setPath(const QString& path)
{
	m_iRes.setPath(path);
}
